<%
  #File:    /app/views/manage/permissions/_role_form.rhtml
  #Author:  Andrew Stone
  #Created: 04.24.2006
  title = "Updating Role Id: #{@role.id}" 
  action = "update_role"
%>
  
<%=error_messages_for("role")%>

<%=start_form_tag(:action => action)%>
<%=start_medium_div_wrapper%>
  <div id="page_title"><%=title%></div>
  <div id="medium">
    <table>
      <tbody>
        <tr>
          <td class="req_label">* Name:</td>
          <td class="data">
            <%=text_field("role","name")%>
          </td>
        </tr>
        <tr>
          <td class="req_label">* Get Contact Info:</td>
          <td class="data">
            <%=check_box("role","gather_contact_info")%> Checking this will require contact info for the user.
          </td>
        </tr>
        <tr>
          <td class="req_label">* Get Address Info:</td>
          <td class="data">
            <%=check_box("role","gather_address_info")%> Checking this will require address info for the user.
          </td>
        </tr>
        <tr>
          <td class="req_list_label">* System Objects: </td>
          <td class="list_data">
            <ul id="system_objects" class="checklist">
              <% 
                sobjects = SystemObject.find_managed
                i = 0;
                sobjects.each do |sobject| 
                  bg = row_class(i)
                  i += 1
                  checked = ""
                  checked = "checked" if @role.has_system_object_id?(sobject.id)
                  bg << "_" << checked if checked.length > 0
                  gid = "system_object_#{sobject.id}" %>
                  <li class="<%=bg%>">
                    <label for="<%=gid%>">
                      <input id="<%=gid%>" name="<%=gid%>" type="checkbox" <%=checked%>/><%=h(sobject.name)%>
                    </label>
                  </li>
              <%
                end %>
            </ul>
          </td>
        </tr>
      </tbody>
    </table>
    <%=hidden_field("role","id")%>
    <div id="actions">
      <%=submit_tag("Cancel")%>
      <%=submit_tag(action.sub(/_/," ").capitalize)%>
    </div>
  </div>
<%=end_div_wrapper%>
<%=end_form_tag%>
